<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" title="商户应用详情" width="600px">
    <Description :column="1" :data="detailData" @register="registerDescription"/>
  </BasicDrawer>
</template>
<script lang="ts" setup>
import {ref, useAttrs} from 'vue';
import {BasicDrawer, useDrawerInner} from '/@/components/Drawer';
import {formDetailSchema} from './mchApp.data';
import {Description, useDescription} from '/@/components/Description/index';
import {getAccessKeyBaseInfo} from '/@/views/system/accessKey/accessKey.api';

const emit = defineEmits(['register']);
  const attrs = useAttrs();
  const detailData = ref<any>({});
  const [registerDescription] = useDescription({
    // data: mockData,
    schema: formDetailSchema,
    labelStyle: {
      marginLeft: '10px',
      width: '100px'
    }
  });
  const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
    setDrawerProps({ confirmLoading: false });
    detailData.value = data.record;

    const accessKey = await getAccessKeyBaseInfo({id: data.record.accessKeyId})
    detailData.value.accessKeyName = accessKey?.name
  });
</script>


<style scoped>

</style>
